package com.mdinfo.system.param;

import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/11/27.
 */
public class RoleParam {

    @Data
    public static class AddParam{
        @NotNull(message = "不能为空")
        @Size(min = 1,max = 10,message = "长度为1-10")
        private String name;            //名称

        @NotNull(message = "不能为空")
        @Size(min = 1,max = 100,message = "长度为1-100")
        private String description;     //描述

        @NotNull(message = "不能为空")
        @Min(value = 1,message = "最小值为1")
        private Integer orderNum;       //排序
    }

    @Data
    public static class ModifyParam{
        @NotNull(message = "不能为空")
        @Min(value = 1,message = "最小值为1")
        private Integer roleId;

        @NotNull(message = "不能为空")
        @Size(min = 1,max = 10,message = "长度为1-10")
        private String name;            //名称

        @NotNull(message = "不能为空")
        @Size(min = 1,max = 100,message = "长度为1-100")
        private String description;     //描述

        @NotNull(message = "不能为空")
        @Min(value = 1,message = "最小值为1")
        private Integer orderNum;       //排序
    }

    @Data
    public static class ListQueryParam{
        @NotNull(message = "不能为空")
        @Min(value = 0,message = "最小值为0")
        private Integer start;

        @NotNull(message = "不能为空")
        @Range(min = 1,max = 50,message = "值为1-50")
        private Integer num;

        private String key;
    }

    @Data
    public static class DeleteParam{
        @NotNull(message = "不能为空")
        @Min(value = 1,message = "最小值为1")
        private Integer roleId;
    }

    @Data
    public static class SetMenuParam{
        @NotNull(message = "不能为空")
        @Min(value = 1,message = "最小值为1")
        private Integer roleId;

        private List<Integer> menuIdList = new ArrayList<>();
    }
}
